SUMMARY A changes file containing a pluggable forms model. See the classes for comments and examples. The form offers a choice of different style of interaction: menu, single select, multiple select, text fill, number slider and cycle. The form can be created on a model, which when the form is accepted by the user, is updated to its new state. The form may be opened in either 'dialog' mode (stops all other interaction), or in 'scheduled' mode (the
view has a scheduledController. The user may inetraction with the dialog with
a mouse/pointer but may also quit/reset/acept the form using the keyboard.
This is modelled on a combination of the FormsView and DBox ideas in the
Analyst, but is written completely from scratch. BH, 25/9/92.
I'd like to thank Markus Geltz <Geltz@informatik.uni-stuttgart.dbp.de> for some bug
fixes and the additional BooleanRow class "!
'From Objectworks(r)\Smalltalk, Release 4 of 25 October 1990 on 14 November 1991 at 12:47:36 pm'!
Object subclass: #Form
instanceVariableNames: 'title rows model isAccepted '
classVariableNames: ''
poolDictionaries: ''
category: 'Forms'!
Form comment:
'I represent an abstract form.
Instance variables:
title <String/Text/ComposedText> The title of the form.
rows <OrderedCollection> The rows on the form.
model <Object> Any object can be a model.
isAccepted <Boolean> a flag to catch when user input has completed.
Bernard Horan -- 12 November 1991'!
!Form methodsFor: 'initialize-release'!
release
model removeDependent: self.
rows do: [:i | i release].
super release!
setModel: aModel
model := aModel.
aModel addDependent: self.
rows := OrderedCollection new.
isAccepted := false! !
!Form methodsFor: 'accessing'!
actionTaken
^isAccepted!
addRow: aFormRow
rows add: aFormRow.
aFormRow holder: self!
model
^model!
rows
^rows!
title
^title!
title: aStringOrText
title := aStringOrText! !
!Form methodsFor: 'building views'!
openDialogView
"Open a dialogView on myself.
As it's a dialogView, the view is modal"
self open.
FormView openDialogViewOn: self!
openScheduledView
"Open a scheduledView on myself, not modal, but scheduled"
self open.
FormView openScheduledViewOn: self! !
!Form methodsFor: 'pluggability'!
acceptAndClose
self accept.
self quit!
quit
isAccepted := true! !
!Form methodsFor: 'updating'!
update: aSymbol
"My model has changed, tell my rows to update if necessary"
rows do: [:row | row update: aSymbol]! !
!Form methodsFor: 'private'!
accept
"I have been accepted, tell my rows to accept, ie put their values into